#ifdef __EOS__
#include <rtthread.h>
#else
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/version.h>
#include <linux/of_platform.h>
#endif

#include "ei_type.h"
#include "ei_common.h"
#include "ei_os.h"
/* #include "audioin.h" */

extern int AUDIOIN_ModInit(void);
extern void AUDIOIN_ModExit(void);
extern EI_S32 AUDIOIN_SRC_Init(void);
extern EI_S32 AUDIOIN_SRC_Exit(void);

#ifdef __EOS__
int audioin_driver_init(void)
{
    AUDIOIN_ModInit();
    AUDIOIN_SRC_Init();
    os_printk("%s\n", "init ok");

    return 0;
}

#else /* __EOS__ */
static int ei_audioin_probe(struct platform_device *pdev)
{
    os_printk("%s\n", "init ok");

    AUDIOIN_ModInit();
    AUDIOIN_SRC_Init();

    return 0;
}

static int ei_audioin_remove(struct platform_device *pdev)
{
    os_printk("%s\n", "exit ok");

    AUDIOIN_ModExit();
    AUDIOIN_SRC_Exit();

    return 0;
}

static const struct of_device_id ei_audioin_match[] = {
    { .compatible = "ei, ei-audioin" },
    {},
};

MODULE_DEVICE_TABLE(of, ei_audioin_match);

static struct platform_driver ei_audioin_driver = {
    .probe          = ei_audioin_probe,
    .remove         = ei_audioin_remove,
    .driver         = {
        .name            = "ei_audioin",
        .of_match_table = ei_audioin_match,
    },
};

os_module_platform_driver(ei_audioin_driver);

MODULE_LICENSE("Proprietary");
#endif /* __EOS__ */

